import { defAxios as request } from '@/utils/http';

export function useSystemApi() {
	return {
		getSysParamDetail,
		saveSysParam,
		refreshSysParamCache,
		getSysParams() {
			return request({
				url: '/sysParam/getSysName',
				method: 'get',
			});
		},
	};
}

/**
 * 获取系统参数详细信息通过系统编码
 *
 * @param {String|Number} dCode 系统参数编码
 * @returns Proxy
 */
function getSysParamDetail(dCode) {
	return request({
		url: '/sysParam/getSysParamDetail',
		method: 'post',
		params: { dCode },
	});
}

/**
 * 保存系统参数信息
 * @param {Object} params 系统参数信息
 * @returns Proxy
 */
function saveSysParam(params) {
	return request({
		url: '/sysParam/saveSysParam',
		method: 'post',
		data: params,
	});
}
/**
 * 更新系统参数缓存
 * @param {Object} params 系统参数信息
 * @returns Proxy
 */
function refreshSysParamCache(params) {
	return request({
		url: '/sysParam/refreshSysParamCache',
		method: 'post',
		data: params,
	});
}
